Python Programs

Hi, Welcome to Code With TJ blog. In this blog you will learn about Python Basics and other Python interview questions.

This article covers the most Python programs that you can use for practicing Python that are trending in Major Search Engines, Below is the list of Python programs that you can start practicing

If you are new to my blog then please consider subscribing to my YouTube channel 

Python Programs

Python Program #1 : Write A Python Program To Convert Centimeters To Inches

Python Program #2 : Write a Python Program to Combine Two Dictionary Adding Values For Common Keys

Python Program #3 : Write a Python Program to Add an Item in a Tuple

Python Program #4 : Write A Program To Perform Different Arithmetic Operations On Numbers In Python

Python Program #5 : Write A Python Program To Implement Zero Division Error Exception Using User Defined Exception

Python Program #6 : Write a Python Program to Define a Module And Import a Specific Function in That Module to Another Program

Python Program #7 : Design A Python Program Which Will Throw User Defined Exception If The Value Entered By User Is Less Than Zero

Python Program #8 : Write Python Code to Merge Two Dictionaries Into a Single One

Python Program #9 : Write a Program to Create Class Employee With id And Name And Display Its Contents

Python Program #10

Python Program #11

Python Program #12 : write a python program to calculate the length of a string

Python Program #13 : write a python program to remove the nth index character from a non-empty string

Python Program #14 : write a recursive program to find factorial of a number using pydatalog

Python Program #15 : write a lambda function to convert measurements from meters to feet

Python Program #16 : write a python program to create a user defined module

Python Program #17 : write a python program to display tables from 1 to 10 using formatting character

Python Program #18 : write a python program to define a module to find fibonacci numbers and import the module to another program

Python Program #19 : write a program that inputs a text file. the program should print all of the unique words in the file in alphabetical order

Python Program #20 : write a program to create concatenate and print a string and accessing substring from a given string.

Python Program #21 : write a python program to capitalize each word in a given string

Python Program #22 : Write a Python Program to Print Prime Numbers Less Than 20

Python Program #23 : Write a Python Program to Print Alternate Numbers Using 2 Threads. Implement Using Wait And Notify Construct

Python Program #24 : Write a Python Program to Change a Given String to a New String Where The First And Last Chars Have Been Exchanged

Python Program #25 : Write a Python Program to Define a Subclass Using Threading And Instantiate The Subclass And Trigger The Thread that Implements The Task of Building Dictionary For Each Character From The The Given Input String

Python Program #26 : Design a Python Program to Calculate Area of Triangle And Circle And Print The Result

Python Program #27 : Write A Python Program To Create A List With Infinite Elements

Python Program #28 : Write A Python Program To Create A List With Different Data Types

Python Program #29 : Write A Python Program To Change The Data Type(Int To Float) Of An Array

Python Program #30 : You Are Given a Number as an Input. You Have to Display All The Numbers From 0 Till X

Python Program #31

Python Program #32

Python Program #33 : The Provided Code Stub Reads Two Integers And From Stdin. Add Logic to Print Two Lines. The First Line Should Contain The Result of Integer Division //. The Second Line Should Contain The Result of Float Division / . no Rounding or Formatting is Necessary

Python Program #34

Python Program #35 : Write a Program to Count The Number of Occurrences of Character in a String in Python

Python Program #36 : Write a Program to Take a Sentence as Input And Display The Longest Word in The Given Sentence

Python Program #37 : Write A Python Script To Display The Sum And Reverse Of The Given Number

Python Program #38 : Imagine That You Wanted to Write a Program That Asks The User to Enter in 5 Grade Values

Python Program #39 : Write A Python Script To Read An Integer 1000 And Reverse The Number

Python Program #40

Python Program #41 : Python Read a Text File Line by Line And Display Each Word Separated by a #

Python Program #42 : Write a Python Program That Calculates The Dot Product of Two Lists Containing The Same Number of Elements

Python Program #43 : Write a Program That Takes a Number N as Input And Prints The Nth Power of 2

Python Program #44 : Write a Program That Takes a Number N as Input And Prints a Pyramid of Numbers With N Rows.

Python Program #45 : Write Some Simple Programs in Python For Formatting Number And Strings

Python Program #46 : Write a Program That Takes a Number `N` as Input And Prints The Sum of The Squares of The First `N` Positive Integers

Python Program #47

Python Program #48

Python Program #49 : Write a Python Class to Reverse a String Word by Word

Python Program #50 : Take an Input n as an Integer And Write a Program to Display a Right Angle Triangle With n Rows And n Columns in Python

Python Program #51 : Take Base b And Height h as an Input And Write a Program to Print a Parallelogram in Python

Python Program #52 : Write a Code to Loop Through a List of Numbers And Print it in Python

Python Program #53 : Write a Python Program to Get Input From The User Using a While Loop And Print if it is an Even Number or Not Until 0 is Not Pressed

Python Program #54 : Write a Python Program to Multiply Two Numbers by Repeated Addition

Python Program #55 : Write A Python Program To Print Your Name 100 Times

Python Program #56 : Get a List of Name as an Input From The User And Make The First Letters in Caps And Print Each Word as a List

Python Program #57

Python Program #58 : Write The Definition of a Function Named Twice That Receives an Integer Argument And Returns an Integer That is Twice The Value of The Parameter

Python Program #59 : Write A Python Script To Delete Duplicate Strings From A List Of Strings

Python Program #60 : Write a Program to Print The Table of a Given Number in Python

Python Program #61 : Given an Integer as an Input Write a Program to Print That Integer

Python Program #62 : Write A Python Script To Read Two Integer Numbers And Perform Arithmetic Operations

Python Program #63 : Write a Python Program to Find The Average of The Best of Two Tests

Python Program #64 : Write a Program That Takes in a Line of Text as Input and Outputs That Line of Text in Reverse. The Program Repeats Ending When The User Enters Done Done Or d For The Line of Text

Python Program #65 : Given a Line of Text as Input Output The Number of Characters Excluding Spaces Periods Or Commas

Python Program #66 : Write a Python Program to Count The Occurrences of Each Word in a Given Sentence

Python Program #67 : Write a Program That Reads Integers user_num And div_num as Input And Outputs user_num Divided by div_num Three Times Using Floor Divisions

Python Program #68 : Write a Program That Reads a List of Integers Into a List as Long as The Integers Are Greater Than Zero Then Outputs The Smallest And Largest Integers in The List

Python Program #69

Python Program #70 : Write A Python Script To Input Side Of A Square And Display Its Area

Python Program #71 : Write A Python Script To Input A Number And Print Its Preceding And Succeeding Number

Python Program #72 : Write a Python Program to Get The Last Part of a String Before a Specified Character

Python Program #73 : Write A Python Script To Perform The Basic Mathematical Operations With Function

Python Program #74 : Write A Python Script To Check Whether A Given Number Is Divisible By 5 Or Not

Python Program #75 : Write A Python Script To Check Whether A Given Number Is Positive Negative Or Zero

Python Program #76 : Write A Python Script To Check Whether A Given Number Is Even Or Odd

Python Program #77 : Write A Python Script To Get All The Substrings Of A Given String

Python Program #78 : Write A Python Script To Generate Divisors Of A Number

Python Program #79 : Python Program to Find The Second Most Repeated Word in a Given String

Python Program #80 : Write A Python Class Named Student With Two Attributes Student_Name Marks

Python Program #81 : Write A Python Class Named Rectangle Constructed By A Length And Width

Python Program #82 : Python Script To Move Mouse Cursor Every Minute || Python Script To Move Mouse Randomly Every Minute

Python Program #83 : Write A Python Script To Generate Prime Numbers Up To N

Python Program #84 : Write A Python Script To Check If A Given Key Already Exists In The Dictionary

Python Program #85 : Write A Python Script To Get Three Numbers And Swap Them

Python Program #86 : Write A Python Script To Run Command Line

Python Program #87 : Write a Program to Print Python is Fun

Python Program #88 : Write A Python Script To Implement Bubble Sort Using List

Python Program #89 : Write A Python Script To Display The Current Date And Time

Python Program #90 : Write A Python Program To Check A String Represent An Integer Or Not

Python Program #91 : Write A Python Script To Print The Docstring(Documentation String) Of The Input Function

Python Program #92 : Write A Python Program To Find Length Of Set

Python Program #93 : Write A Python Program To Find Common Items From Two Lists

Python Program #94 : Write A Python Program To Get The Smallest Number From The List

Python Program #95 : Write A Python Program To Find ASCII Value Of Character

Python Program #96 : Write A Python Script To Sort A List Given By User

Python Program #97 : Write a Program Whose Input is Two Integers. Output The First Integer And Subsequent Increments of 5 as Long as The Value is Less Than or Equal to The Second Integer

Python Program #98 : Write a Program Whose Input is a String Which Contains a Character And a Phrase And Whose Output Indicates The Number of Times The Character Appears in The Phrase

Python Program #99 : Write A Python Script To Merge Two Dictionaries

Python Program #100 : Write A Python Script To Traverse A Dictionary

Python Program #101 : Write A Python Program To Extract The First N Characters Of A String

Python Program #102 : Write A Python Program To Generate A Scatter Plot Of Name Vs Percentage

Python Program #103 : Write A Python Code To Create A List With Mixed Data Types

Python Program #104 : Write a Program That Takes a Number n as The Input And Prints it to The Output

Python Program #105 : Write a Python Program to Draw Scatter Plots to Compare Two Features of The Iris Dataset

Python Program #106 : Write A Python Script To Add Key To A Dictionary

Python Program #107 : Write A Python Script To Append A List To The Second List

Python Program #108 : Write A Python Script To Add Members In A Set

Python Program #109 : Write A Python Script To Generate The Following Pattern Up To N Lines

Python Program #110 : Write A Python Script To Create A List And Display The List Element In Reverse Order

Python Program #111 : Write A Python Script To Create A List Of First N Natural Numbers

Python Program #112 : Write A Python Script To Create A List Of City Names Taken From The User

Python Program #113 : Write A Python Script To Create A Tuple With Different Data Types

Python Program #114 : Write A Python Script To Generate Fibonacci Terms Using Generator Function

Python Program #115 : Write A Python Script To Create A Class That Performs Basic Calculator Operations

Python Program #116 : Write A Python Script To Create Simple Calculator Using If-Else-If Statement

Python Program #117 : Write A Python Script To Concatenate Following Dictionaries To Create A New One

Python Program #118 : Write A Python Script To Print String With Prefix Of Ten Spaces By Using Format

Python Program #119 : Write A Python Script To Create A List Where Each Element Of The List Is A Digit Of A Given Number

Python Program #120 : Write a Python Program to Extract Unique Values Dictionary Values

Python Program #121 : Write A Python Script To Create A String In 3 Different Possible Ways

Python Program #122 : Write a Python Program to Eliminate All Empty Lists From a Given List of Lists

Python Program #123 : Write A Python Script To Open And Read The File

Python Program #124 :

Python Program #125 : Write A Python Program To Write A List Content To A File

Python Program #126 : Write a Python Program to Generate a Line Plot of Name vs Salary

Python Program #127 : Write a Python Program to Check Whether an Element Exists Within a Tuple

Python Program #128

Python Program #129 : Write A Python Program To Create A Function Cube Which Cube All The Elements Of An Array

Python Program #130 : Write a Python Code to Reverse The Given Integer And Print The Integer

Python Program #131 : Write A Python Program To Understand The Use Of Else And Finally Block With Try Block

Python Program #132 : Write A Python Program To Reverse A Tuple

Python Program #133 : Write A Python Program To Print A To Z

Python Program #134 : Write A Python Program To List Out All Prime Numbers Between Two Integers M And N

Python Program #135 : Use Recursion to Print The Sum of All Numbers Up to a Given Input

Python Program #136 : Write A Python Program To Test Whether A Passed Letter Is A Vowel Or Not

Python Program #137 : Write A Python Program To Check The Given Number Is Prime Number Or Not

Python Program #138 : Write A Python Program To Remove An Empty Tuple(S) From A List Of Tuples

Python Program #139 : Write a Python Program That Accepts a Sentence And Find The Number of Words Digits Uppercase Letters And Lowercase Letters

Python Program #140 : Write A Python Program To Enter Two Integers And Perform All Arithmetic Operations On Them

Python Program #141

Python Program #142 : Write A Python Program To Triple All Numbers Of A Given List Of Integers. Use Python Map

Python Program #143 : Write A Python Script Using Function To Calculate XY

Python Program #144

Python Program #145

Python Program #146 : Write A Python Program To List All The Words Starting With Vowels In A Given Input Paragraph

Python Program #147 : Write A Python Program To Remove The Characters Which Have Odd Index Values Of A Given String

Python Program #148 : Create a Python Code That Takes Every Object From The List And Check if it Has a List Object or Not. if a List Object is Present in a List it Should be Unpacked And The Overall Count of The List Should be Conveyed. if List Object is Not Present in The Existing List it Should Say Cannot Unpack

Python Program #149 : Write a Python Program to Merge Two Lists And Sort it

Python Program #150 : Write a Python Program to Replace Last Value of Tuples in a List

Python Program #151 : Write a Python Program to Print Fibonacci Series up to n Terms

Python Program #152

Python Program #153 : Write a Python Program to Convert Kilometers to Miles

Python Program #154 : Write a Python Program to Store First Year Percentage of Students in Array. Write Function For Sorting Array of Floating Point Numbers in Ascending Order Using Quick Sort And Display Top Five Scores

Python Program #155

Python Program #156

Python Program #157

Python Program #158 : Write a Python Program to Print All ASCII Character With Their Values

Python Program #159

Python Program #160 : Write a Python Program to Generate a Random String

Python Program #161 : Write A Python Program To Create A Histogram From A Given List Of Integers

Python Program #162 : Write a Python Program to Print Multi Line Strings

Python Program #163 : Write a Function to Find All The Words in a String Which Are Palindrome

Python Program #164 : Write a Python Program to Count The Frequencies in a List Using Dictionary

Python Program #165 : Write a Python Program to Determine How Many Times a Given Letter Occurs in a String Recursively

Python Program #166 : Write a Python Program That Takes in a Line of Text as Input And Outputs That Line of Text in Reverse The Program Repeats Ending When The User Enters Done Done Or d For The Line of Text

Python Program #167

Python Program #168 : Write a Python Program to Print 5 Lines About Yourself Using Print Function

Python Program #169

Python Program #170 :

Python Program #171 : Write a Python Program to Print Even Numbers in The List Using Function

Python Program #172 : Sum All Prime Numbers Ending With 7 From 1 100 in Python

Python Program #173

Python Program #174 : Write a Recursive Function to Print a String Backwards in Python

Python Program #175

Python Program #176 : Write a Python Program to Compute GCD LCM of Two Numbers Using Functions

Python Program #177

Python Program #178 : Write a Python Program Using The Function to Print Area of Rectangle And Area of Circle

Python Program #179

Python Program #180

Python Program #181 :

Python Program #182 : Write a Program to Check Whether a String is Palindrome or Not in Python

Python Program #183 : Write a Python Program That Produces a Bigram Feature Vector From a Given String

Python Program #184 : Write a Python Program to Find Number of Days in a Given Month of a Given Year

Python Program #185

Python Program #186 : Write a Python Program to Find The Sum of Digits of a Given Number Eg Sum of Number 123 Will be 6

Python Program #187 : Write a Python Program to Print Multiplication Table Using Format Function Inside Print

Python Program #188 : write a python program to read the data from xml file using pandas library

Python Program #189

Python Program #190

Python Program #191

Python Program #192

Python Program #193

Python Program #194

Python Program #195

Python Program #196

Python Program #197

Python Program #198

Python Program #199 : Write a Python Program to Create Append And Remove Lists in Python

Python Program #200 :

Python Program #201 :

Python Program #202

Python Program #203

Python Program #204 : Write a Python Script Using Function to Calculate x Power y

Python Program #205 : 2 Ways Write a Python Program That Accepts a String And Calculate The Number of Digits And Letters Stands Out from Alternatives

Python Program #206 : Write a Python Program to Find Factorial of a Number Using Function

Python Program #207 : Write a Python Program to Make Calculator Using Function

Python Program #208

Python Program #209

Python Program #210 : Python Program to Print All Odd Indexed Elements of a List

Python Program #211 : Write a Python Program to Put Even And Odd Elements in a List Into Two Different Lists

Python Program #212 : write a python program to read two numbers

Python Program #213 : Write a Python Program to Read Three Numbers And Find The Smallest Among Them

Python Program #214 : Write a Python Program to Read The Text File Using Read Readlines And Readline Methods

Python Program #215 : Write a Python Program to Read The Salary For nc Employees

Python Program #216 : Write a Python Program to Read The Marks of Three Subjects And Find The Average of Them

Python Program #217 : Write a Python Program to Read The Last n Lines of a File

Python Program #218 : Write a Python Program to Read The Contents of a File in Reverse Order

Python Program #219 : Write a Python Program to Read The Contents of a File

Python Program #220 : Write a Python Program to Read Student Data From a Binary File

Python Program #221 : write a python program to read specified number of lines from the specified file using functions

Python Program #222 : Write a Python Program to Find The Second Largest Number in a List

Python Program #223 : Use python to calculate how many different passwords can be formed with 6 lower case English letters. for a 1 letter password there would be 26 possibilities. for a 2 letter password each letter is independent of the other so there would be 26 times 26 possibilities. using this information print the amount of possible passwords that can be formed with 6 letters

Python Program #224 : write a python program to find the largest number in a list

Python Program #225 : Write a Python Program to Sort The List According to The Second Element in Sublist

Python Program #226 : write a python program to solve a classic ancient Chinese puzzle. we count 35 heads and 94 legs among the chickens and rabbits in a farm. how many rabbits and how many chickens do we have?

Python Program #227 : write a program that uses input to prompt a user for their name and then welcomes them. note that input will pop up a dialog box. enter Sarah in the pop-up box when you are prompted so your output will match the desired output.

Python Program #228 : write a python program that counts and returns the number of words in a given text

Python Program #229 : palindrome string program in python using for loop

Python Program #230 : statistics are often calculated with varying amounts of input data. write a program that takes any number of integers as input and outputs the average and max

Python Program #231 : Write a Python Program to Count The Total Number of Digits in a Number Using a While Loop

Python Program #232 : Armstrong number in python

Python Program #233 : write a program to find area of triangle

Python Program #234 : write a python program to generate 26 text files named a.txt b.txt and so on up to z.txt

Python Program #235 : Write a Python Program to Find Largest of Three Numbers

Python Program #236 : write a program to check whether a number is prime or not in python

Python Program #237 : write a python program to find all the prime numbers from 2 to 100

Python Program #238 : write a program that prompts for a file name then opens that file and reads through the file and print the contents of the file in upper case. use the file words.txt to produce the output below

Python Program #239 : write a program to check whether a number is even or odd

Python Program #240 : write a program to calculate simple interest python

Python Program #241 : Take Two Strings s1 And s2 From The User. Write a Program to Create a New String by Appending s1 in The Middle of s2

Python Program #242 : take two strings s1 and s2 from the user. write a program to check if two strings are balanced. for example strings s1 and s2 are balanced if all the characters in the s1 are present in s2. the character's position doesn't matter

Python Program #243 : write a program to check whether a number is palindrome or not in python

Python Program #244 : write a program to check leap year in python

Python Program #245 : python program for sum of squares of first n natural numbers

Python Program #246 : How to Reverse a String in Python

Python Program #247 : write a program to reverse a number in python

Python Program #248 : Write a Program to Convert Temperature From Fahrenheit to Celsius in Python

Python Program #249 : Python Reverse String

Python Program #250 : pattern program in python

Python Program #251 : write a program to swap two numbers using third variable

Python Program #252 : Write a Python Program to Check Whether a Character is Alphabet or Not

Python Program #253 : write a python program to display your name using interactive

Python Program #254 : Write a Python Program to Detect The Number of Local Variables Declared in a Function

Python Program #255 : Write a Python Program to Count The Number of Even And Odd Numbers From a Series of Numbers

Python Program #256 : Factorial Program in Python

Python Program #257 : Write a Python Program to Get a List Sorted in Increasing Order by The Last Element in Each Tuple From a Given List of Non Empty Tuples

Python Program #258 : Write a Program to Check Whether a Year is Leap Year or Not in Python

Python Program #259 : Write a Python Program to Sum All The Items in a List

Python Program #260 : Write a Python Program to Reverse The Content of a File And Store it in Another File

Python Program #261 : Write a Program to Find Out Absolute Value of an Input Number in Python

Python Program #262 : Write a Python Program to Get The Python Version You Are Using

Python Program #263 : Write a Python Program to Copy The Contents of a File to Another File

Python Program #264 : write a python program to find the repeated items of a tuple

Python Program #265 : Given a List of Integer Values Write a Python Program to Check Whether it Contains Same Number in Adjacent Position Display The Count of Such Adjacent Occurrences

Python Program #266 : Write a Program to Prompt The User For Hours And Rate in Python

Python Program #267 : Write a Python Program to Convert a Tuple of String Values to a Tuple of Integer Values

Python Program #268 : Write a Program to Demonstrate Working With Tuples in Python

Python Program #269 : Write a Program to Swap Two Numbers Without Using Third Variable in Python

Python Program #270 : Write a Python Program to Count The Frequency of Words in a File

Python Program #271 : Write a Python Program to Concatenate Two Strings

Python Program #272

Python Program #273 : Write a Program That Inputs a Text File. The Program Should Print The Unique Words in The File in Alphabetical Order

Python Program #274 : Write a Python Program Calculate The Product Multiplying All The Numbers of a Given Tuple

Python Program #275 : Write a Python Program to Get a String Made of The First 2 And The Last 2 Chars From a Given a String

Python Program #276 : Write a Python Program to Read Contents of first.txt File And Write Same Content in second.txt File

Python Program #277 : Write a Program to Reverse an Integer Value 54321 Python

Python Program #278 : Write a Python Program to Find The Highest 3 Values of Corresponding Keys in a Dictionary

Python Program #279 : Write a Python Program to Check if a Specified Element Presents in a Tuple of Tuples

Python Program #280 : Write a Program to Demonstrate Working With Dictionaries in Python

Python Program #281 : Write a Python Program to Generate The Next 15 Leap Years Starting From a Given Year. Populate The Leap Years Into a List And Display The List

Python Program #282 : Write a Program to Demonstrate Different Number Data Types in Python

Python Program #283 : write a python program create employee txt file and store employee name and address

 










































Post a Comment

0 Comments